﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Devices.ascx.cs" Inherits="PayrollHR.Administration.Modules.DevicesControl" %>
<%@ Register Src="ToolTipLabelControl.ascx" TagName="ToolTipLabelControl" TagPrefix="uc1" %>
<%@ Register Src="SimpleTextBox.ascx" TagName="SimpleTextBox" TagPrefix="uc2" %>
<%@ Register Src="ConfirmationBox.ascx" TagName="ConfirmationBox" TagPrefix="uc3" %>
<script type="text/javascript">
    $(window).bind('load', function () {
        var cbHeader = $(".cbHeader input");
        var cbRowItem = $(".cbRowItem input");
        cbHeader.bind("click", function () {
            cbRowItem.each(function () { this.checked = cbHeader[0].checked; })
        });
        cbRowItem.bind("click", function () { if ($(this).checked == false) cbHeader[0].checked = false; });
    });
    function ClearText() {
        document.getElementById('<%=txtDeviceCode.ClientID%>').value = '';
        document.getElementById('<%=txtDeviceName.ClientID%>').value = '';
    };
</script>
<asp:UpdatePanel ID="upFormCustomer" runat="server">
    <ContentTemplate>
        <div class="section-header">
            <div class="title">
                <img src="Common/ico-configuration.png" alt="Admin.Customers.ManagerCustomer" />
                <%=GetLocaleResourceString("Admin.Devices.ManagerDevices")%>
            </div>
            <div class="options">
                <asp:HyperLink runat="server" Visible="False" ID="hlexport" ForeColor="#6600CC">[hlexport]</asp:HyperLink>

                <asp:Button ID="SearchButton" runat="server" Text="Filter"
                    CssClass="adminButtonBlue" OnClick="SearchButton_Click" ToolTip="Filter" />
                <asp:Button runat="server" Text="Delete"
                    CssClass="adminButtonBlue" ID="btnDelete" OnClick="btnDelete_Click" ValidationGroup="ExportXLS"
                    ToolTip="Delete Device" />
                <uc3:ConfirmationBox ID="cbDelete" runat="server" TargetControlID="btnDelete"
                    YesText="<% $PayrollResources:Admin.Common.Yes %>" NoText="<% $PayrollResources:Admin.Common.No %>"
                    ConfirmText="<% $PayrollResources:Admin.Common.AreYouSure %>" />
                <input type="button" onclick="location.href = 'AddDevice.aspx'" value="<%=GetLocaleResourceString("Admin.Devices.AddNew")%>"
                    id="btnAddNew" class="adminButtonBlue" title="<%=GetLocaleResourceString("Admin.Customers.AddNew")%>" />
            </div>
        </div>
        <div style="border: 1px solid #2F00FF; border-radius: 15px;">
            <table>
                <tr>
                    <td class="adminTitle">
                        <uc1:ToolTipLabelControl ID="lblDeviceCode" runat="server" Text="<% $PayrollResources:Admin.AddDevice.DeviceCode.Text %>"
                            ToolTip="<% $PayrollResources:Admin.AddDevice.DeviceCode.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                    </td>
                    <td class="adminData">
                        <asp:TextBox ID="txtDeviceCode" BackColor="Yellow" CssClass="adminInput" MaxLength="64" runat="server"></asp:TextBox>
                    </td>
                    <td class="adminTitle">
                        <uc1:ToolTipLabelControl ID="lblDeviceName" runat="server" Text="<% $PayrollResources:Admin.AddDevice.DeviceName.Text %>"
                            ToolTip="<% $PayrollResources:Admin.AddDevice.DeviceName.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                    </td>
                    <td class="adminData">
                        <asp:TextBox ID="txtDeviceName" BackColor="Yellow" CssClass="adminInput" MaxLength="128" runat="server"></asp:TextBox>
                    </td>
                    <td class="adminTitle"></td>
                    <td>
                        <a id="aCleare" href="javascript:ClearText()">Xóa Tìm Kiếm</a>
                    </td>
                </tr>
            </table>
        </div>
        <p></p>
        <asp:GridView ID="gvDevicess" runat="server" AutoGenerateColumns="False" Width="100%" DataKeyNames="DeviceID"
            OnPageIndexChanging="gvDevicess_PageIndexChanging" CellPadding="4" AllowPaging="True" ViewStateMode="Enabled"
            PageSize="20">
            <Columns>
                <asp:TemplateField ItemStyle-Width="0.5%" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        <asp:CheckBox ID="cbSelectAll" runat="server" CssClass="cbHeader" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="cbDevices" runat="server" CssClass="cbRowItem" ToolTip="<% $PayrollResources:Admin.Customers.CustName.ToolTip %>" />
                        <asp:HiddenField ID="hfDeviceID" runat="server" Value='<%# Eval("DeviceID") %>' />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="0.5%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã Thiết Bị" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:HyperLink ID="ActionHyperLink" runat="server" ToolTip="Click vào mã để xem chi tiết" Text='<%# Eval("DeviceCode") %>' NavigateUrl='<%# String.Format("../AddDevice.aspx?DeviceID={0}", Eval("DeviceID")) %>' />
                    </ItemTemplate>
                    <ItemStyle Width="10%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên Thiết Bị" ItemStyle-Width="20%">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("DeviceName").ToString())%>
                    </ItemTemplate>
                    <ItemStyle Width="20%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ghi Chú"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("Note").ToString())%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="20%" />
                </asp:TemplateField>
            </Columns>
            <PagerSettings PageButtonCount="50" Position="TopAndBottom" />
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="upFormCustomer">
    <ProgressTemplate>
        <div class="progress">
            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/UpdateProgress.gif"
                AlternateText="update" />
            <%=GetLocaleResourceString("Admin.Common.Wait...")%>
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>
